package com.zhiy.com.estation.ui.fragment.upload;

import com.zhiy.com.estation.api.ApiResult;

import io.reactivex.functions.Consumer;
import okhttp3.RequestBody;

/**
 * Created by Zyh on 2016/12/6.
 */
public class UploadPresent extends UploadAvarContract.prensenter {
    @Override
    public void upload(String userid, RequestBody requestBody) {
        model.upload(userid,requestBody).subscribe(new Consumer<ApiResult<String>>() {
            @Override
            public void accept(ApiResult<String> stringApiResult) throws Exception {
                view.showMsg(stringApiResult.getMsg());
                if (stringApiResult.getCode()==0){
                    view.isSuccess(stringApiResult.getData());
                }else {
                    view.isFailure();
                }
            }
        });

    }
}
